package top.aprillie.mamabike.record.dao;

import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;
import top.aprillie.mamabike.record.entity.RideRecord;

import java.util.List;

@Mapper
@Component(value = "rideRecordMapper")
public interface RideRecordMapper {
    int deleteByPrimaryKey(Long id);

    int insert(RideRecord record);

    int insertSelective(RideRecord record);

    RideRecord selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(RideRecord record);

    int updateByPrimaryKey(RideRecord record);

    /**
     * 根据用户id查询骑行记录
     *
     * @param userId
     * @return
     */
    RideRecord selectRecordNotClosed(Long userId);

    /**
     * 根据单车编号查询用户骑行记录中正在进行的单车骑行记录
     * @param bikeNo
     * @return
     */
    RideRecord selectBikeRecordOnGoing(Long bikeNo);

    /**
     * 根据用户id查询下10条id大于lastId的记录
     * @param userId
     * @param lastId
     * @return
     */
    List<RideRecord> selectRideRecordPage(Long userId, Long lastId);

}